package com.fatgirl.patterns.iterator
{
	/**
	 * 倒序数组迭代器 
	 * @author iceman
	 * 
	 */
	public class ArrayReverseIterator implements IIterator
	{
		private var m_collection:Array;
		private var m_index:uint;
		public function ArrayReverseIterator(_arr:Array)
		{
			m_collection = _arr;
			m_index = m_collection.length - 1;
		}
		
		/**
		 * 重置 
		 * 
		 */
		public function reset():void
		{
			m_index = m_collection.length - 1;
		}
		
		/**
		 * 下一个 
		 * @return 
		 * 
		 */
		public function next():Object
		{
			return m_collection[m_index--];
		}
		
		/**
		 * 是否有下一个 
		 * @return 
		 * 
		 */
		public function hasNext():Boolean
		{
			return m_index>=0;
		}
	}
}